
from feature import Feature, FeatureParser, registerFeatureParserClass

class SnpFeatureParser(FeatureParser):
  '''
  Parser for lines in snp-results.txt files.
  Parses tab-separated string:
  aM11.illumina   Y       10      85280   ...
  '''
  def parse(self, line):
      if line == None or line.startswith("#"): return None
      if line.startswith("Sample"): return None
      cols = line.strip().split("\t")
      if len(cols)<4: return None
      return Feature("chr%s" % cols[2], cols[3], cols[3], line)
  def getMaxFeatureSize(self):
      return 1

registerFeatureParserClass("snp-results", SnpFeatureParser)

